<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html><head>
<!--Converted with LaTeX2HTML 98.1 release (February 19th, 1998)
originally by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->


<title>What's Cryptanalysis?</title>
<meta name="description" content="Problem A: What's Cryptanalysis?">
<meta name="keywords" content="htmlatex">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="STYLESHEET" href="acm-10008_files/htmlatex.css">
</head><body bgcolor="#ffffff" lang="EN">

<h1><br clear="all"><center><table bgcolor="#0060f0"><tbody><tr><td><b><font color="#c0ffff" size="5">&nbsp;<a name="SECTION0001000000000000000000">
What's Cryptanalysis?</a>&nbsp;</font></b></td></tr></tbody></table></center>
</h1>

Cryptanalysis is the process of breaking someone else's cryptographic
writing.  This sometimes involves some kind of statistical analysis of
a passage of (encrypted) text.  Your task is to write a program
which performs a simple analysis of a given text.

<h2><font color="#0070e8"><a name="SECTION0001001000000000000000">
Input</a>&nbsp;</font>
</h2>

The first line of input contains a single positive decimal integer
<i>n</i>.  This is the number of lines which follow in the input.  The next
<i>n</i> lines will contain zero or more characters (possibly including
whitespace).  This is the text which must be analyzed.

<h2><font color="#0070e8"><a name="SECTION0001002000000000000000">
Output</a>&nbsp;</font>
</h2>

Each line of output contains a single uppercase letter, followed by a
single space, then followed by a positive decimal integer.  The integer
indicates how many times the corresponding letter appears in the input
text.  Upper and lower case letters in the input are to be considered
the same.  No other characters must be counted.  The output must be
sorted in descending count order; that is, the most frequent letter is
on the first output line, and the last line of output indicates the
least frequent letter.  If two letters have the same frequency, then
the letter which comes first in the alphabet must appear first in the
output.  If a letter does not appear in the text, then that letter must
not appear in the output.

<h2><font color="#0070e8"><a name="SECTION0001003000000000000000">
Sample Input</a>&nbsp;</font>
</h2>

<pre>
3
This is a test.
Count me 1 2 3 4 5.
Wow!!!!  Is this question easy?
</pre>
<h2><font color="#0070e8"><a name="SECTION0001004000000000000000">
Sample Output</a>&nbsp;</font>
</h2>

<pre>
S 7
T 6
I 5
E 4
O 3
A 2
H 2
N 2
U 2
W 2
C 1
M 1
Q 1
Y 1
</pre>

<p>
<br></p><hr>
<address>
<i>Miguel Revilla</i>
<br><i>2000-08-22</i>
</address>
</body></html>